<template>
  <div>
    <div class="bgfff mtrbl20 ptrbl20 nopb20">
    <el-row :gutter="20">
      <!--用户数据-->
      <el-col :span="24" :xs="24">
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
          <el-form-item label="姓名" prop="realName">
            <el-input
              v-model="queryParams.realName"
              placeholder="请输入姓名"
              clearable
              size=""
              style="width: 200px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="证件号" prop="idNumber" label-width="68px">
            <el-input
              v-model="queryParams.idNumber"
              placeholder="请输入证件号"
              clearable
              size=""
              style="width: 200px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="纳税人类型" prop="taxIdentity" label-width="100px">
            <el-select
              v-model="queryParams.taxIdentity"
              placeholder="全部"
              clearable
              multiple
              collapse-tags
            >
              <el-option label="个体工商户" value="1"></el-option>
              <el-option label="临时税务登记" value="0"></el-option>
              <el-option label="自然人" value="88"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="medium" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="medium" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
     </el-col>
     </el-row>
    </div>
    <div class="app-container">
      <el-row :gutter="20">
        <!--用户数据-->
        <el-col :span="24" :xs="24">
        <el-table v-loading="loading" :data="predeclareDataList">
          <el-table-column fixed label="序号" prop="" width="55" align="center">
            <template slot-scope="scope">
              <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
            </template>
          </el-table-column>
          <el-table-column label="所属客户企业" align="left" key="companyNames" prop="companyNames" :show-overflow-tooltip="true"/>
          <el-table-column label="管理企业" align="left" key="companyAdminNames" prop="companyAdminNames" :show-overflow-tooltip="true"/>
          <el-table-column label="姓名" align="left" key="realName" prop="realName" />
          <el-table-column label="证件号" align="left" key="idNumber" prop="idNumber" />
          <el-table-column label="税号/临登号" align="left" key="taxNo" prop="taxNo" :show-overflow-tooltip="true"/>
          <el-table-column label="申报日期" align="left" key="months" prop="months" />
          <el-table-column label="申报金额" align="left" key="totalMoney" prop="totalMoney" />
          <el-table-column label="完税状态" align="left" key="declareStatus.name" prop="declareStatus.name" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              v-hasPermi="['taxmsg:predeclare:dataDetailList']"
              @click="handleView(scope.row)"
            >查看明细</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>
  </div>
</div>
</template>

<script>
import { predeclareDataList } from "@/api/taxmsg/predeclareDetails";
export default {
  name: "PredeclareDetails",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      predeclareDataList: null,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        realName: undefined,
        idNumber: undefined,
        taxIdentity: undefined,
        batchId: this.$route.params && this.$route.params.id
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询用户列表 */
    getList() {
      this.loading = true;
      predeclareDataList(this.queryParams).then(response => {
          this.predeclareDataList = response.data.list;
          this.total = response.data.total;
          this.loading = false;
        }
      );
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      //this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 详情按钮操作 */
    handleView(row) {
      const id = row.id || this.ids[0];
      this.$router.push("/predeclare/details2/" + id);
    },
  }
};
</script>
<style scoped lang="scss">
</style>